﻿@using Chaine.DAO
@model Chaine.Models.EventModels
@{
    var fileNames = EventManager.GetPhotosFileName(Model.StartDateTime.ToString("yyyyMMdd"));
    ViewBag.Title = Model.Title + ", " + (fileNames == null ? "0" : fileNames.Count.ToString()) + " Photos";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section maincontent{
    <link href="@Url.Content("~/Scripts/NFLightBox/css/nf.lightbox.css")" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="@Url.Content("~/Scripts/NFLightBox/js/NFLightBox.js")"></script>
    <script type="text/javascript">
        $().ready(function () {
            $('#event-photos-thumbs dl').hover(function () {
                $(this).find('dd a').css('visibility', 'visible');
            }, function () {
                $('#event-photos-thumbs dd a').css('visibility', 'hidden');
            });

            var settings = { containerResizeSpeed: 350 };
            $('#event-photos-thumbs dt a').lightBox(settings);
        });
    </script>
    @if (ViewData["delete-success"] != null)
    {
        <!--删除成功-->
        <div class="alert alert-success">
            <a class="close" data-dismiss="alert" href="#">×</a> Delete photo successfully!
        </div>
    }
    @if (ViewData["upload-success"] != null)
    {
        <!--上传成功-->
        <div class="alert alert-success">
            <a class="close" data-dismiss="alert" href="#">×</a> Upload photo successfully!
        </div>
    }
    <h2 class="page-header">
        @ViewBag.Title</h2>
    <p>
        @Html.ActionLink("Upload Photos", "upload", null, new { @class = "btn" })
    </p>
    @if (fileNames != null)
    {
        <div id="event-photos-thumbs">
            @foreach (var item in fileNames)
            {
                var date = Model.StartDateTime.ToString("yyyyMMdd");
                <dl>
                    <dt class="thumbnail"><a class="event-photo-thumb" href="@Url.Content("~/events/photo/" + date + "/photos/" + item.ToString())">
                        <img alt="" src="@Url.Content("~/events/photo/" + date + "/thumbs/" + item.ToString())" />
                    </a></dt>
                    <dd>
                        @Html.ActionLink("Delete", "delete", new { filename = item.Substring(0, item.Length - 4) })
                    </dd>
                </dl>
            }
        </div>
    }
}
@section sidebar{
    @Html.Partial("~/views/shared/_AdminSidebar.cshtml")
}
